import 'package:flutter/material.dart';

// 最近访问
class DynamicLivingItemWidget extends StatelessWidget {
  final String avatar; //头像
  final String upName; //up名称
  final String? code; //房间号
  const DynamicLivingItemWidget({
    super.key,
    required this.avatar,
    required this.upName,
    this.code,
  });
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.only(
        left: 10,
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Padding(
            padding: const EdgeInsets.only(bottom: 4),
            child: Stack(
              alignment: Alignment.bottomCenter,
              children: [
                Container(
                  padding: const EdgeInsets.all(1),
                  margin: const EdgeInsets.only(bottom: 4),
                  decoration: BoxDecoration(
                      border: Border.all(
                        color: const Color.fromARGB(255, 249, 150, 211),
                        width: 1,
                      ),
                      borderRadius: BorderRadius.circular(26)),
                  child: CircleAvatar(
                    radius: 25,
                    backgroundImage: AssetImage(avatar),
                    backgroundColor: const Color(0xfff4f5fa),
                  ),
                ),
                Container(
                  width: 60,
                  height: 20,
                  decoration: BoxDecoration(
                    color: const Color.fromARGB(255, 249, 150, 211),
                    borderRadius: BorderRadius.circular(12),
                    border: Border.all(color: Colors.white, width: 1),
                  ),
                  child: const Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Icon(
                        Icons.bar_chart,
                        size: 14,
                        color: Colors.white,
                      ),
                      Text(
                        '直播中',
                        style: TextStyle(
                          color: Colors.white,
                          fontSize: 10,
                        ),
                      )
                    ],
                  ),
                ),
              ],
            ),
          ),
          Expanded(
            flex: 1,
            child: SizedBox(
              width: 64,
              child: Text(
                upName,
                textAlign: TextAlign.center,
                overflow: TextOverflow.ellipsis,
                maxLines: 2,
                style: const TextStyle(
                  height: 1.1,
                  fontSize: 12,
                  color: Color.fromARGB(255, 87, 87, 89),
                ),
              ),
            ),
          )
        ],
      ),
    );
  }
}
